package com.fis.hlo.pm.client;

import java.net.MalformedURLException;
import java.net.URL;

import javax.xml.namespace.QName;

import com.fis.hlo.pm.invoices.InvoicesTransferer;
import com.fis.hlo.pm.invoices.InvoicesTransfererService;
import com.fis.mca.action.ActionTransfererService;
import com.fis.mca.config.Config;
import com.fis.mca.config.ConfigConstant;

public class InvoicesTransfererClient {

	private static final QName SERVICE_NAME = new QName(
			"http://invoices.pm.hlo.fis.com/", "InvoicesTransfererService");
	private static final String WSDL_URL = Config
			.getURL(ConfigConstant.INVOICES_PORT_KEY);
	private static final InvoicesTransferer port;
	private static final InvoicesTransfererService ss;

	private InvoicesTransfererClient() {

	}

	static {
		URL url = null;
		try {
			url = new URL(WSDL_URL);
		} catch (MalformedURLException e) {
			java.util.logging.Logger.getLogger(
					ActionTransfererService.class.getName()).log(
					java.util.logging.Level.INFO,
					"Can not initialize the default wsdl from {0}", WSDL_URL);
		}

		ss = new InvoicesTransfererService(url, SERVICE_NAME);
		port = ss.getInvoicesTransfererPort();
	}

	public static InvoicesTransferer getService() {
		return port;
	}

}
